*Code for manuscript BJPOLS-D-25-00458R1: Legislator or Representative 



**********************************************************************
*********************Figure 1*****************************************
**********************************************************************
*use data "Legislator or Representative Wide.dta"
mean q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8 q2_9 q2_10 if monadic==1 //DK
mean q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8 q2_9 q2_10 if monadic==2 //UK
mean q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8 q2_9 q2_10 if monadic==3 //US
mean q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8 q2_9 q2_10 if monadic==4 //DE
gen functional=(q2_1+q2_2+q2_3+q2_4+q2_5)/5
gen relational=(q2_6+q2_7+q2_8+q2_9+q2_10)/5
mean functional, over(monadic)
mean relational, over(monadic)
*Stored in new data set Figure 1 and 2
*use data "Figure 1 and 2.dta"
*Lines for figure 1 are preparred using the followin code
*DK
//gen yline_func_dk=.
//replace yline_func_dk=8.40 if inrange(Xpos_country, 1, 6)
//gen yline_func_dk_lower=.
//replace yline_func_dk_lower=8.34 if inrange(Xpos_country, 1, 6)
//gen yline_func_dk_upper=.
//replace yline_func_dk_upper=8.46 if inrange(Xpos_country, 1, 6)
//gen yline_rel_dk=.
//replace yline_rel_dk=6.79 if inrange(Xpos_country, 6, 11)
//gen yline_rel_dk_lower=.
//replace yline_rel_dk_lower=6.71 if inrange(Xpos_country, 6, 11)
//gen yline_rel_dk_upper=.
//replace yline_rel_dk_upper=6.87 if inrange(Xpos_country, 6, 11)
*UK
//gen yline_func_uk=.
//replace yline_func_uk=8.36 if inrange(Xpos_country, 1, 6)
//gen yline_func_uk_lower=.
//replace yline_func_uk_lower=8.30 if inrange(Xpos_country, 1, 6)
//gen yline_func_uk_upper=.
//replace yline_func_uk_upper=8.41 if inrange(Xpos_country, 1, 6)
//gen yline_rel_uk=.
//replace yline_rel_uk=7.77 if inrange(Xpos_country, 6, 11)
//gen yline_rel_uk_lower=.
//replace yline_rel_uk_lower=7.70 if inrange(Xpos_country, 6, 11)
//gen yline_rel_uk_upper=.
//replace yline_rel_uk_upper=7.83 if inrange(Xpos_country, 6, 11)
*US
//gen yline_func_us=.
//replace yline_func_us=8.40 if inrange(Xpos_country, 1, 6)
//gen yline_func_us_lower=.
//replace yline_func_us_lower=8.34 if inrange(Xpos_country, 1, 6)
//gen yline_func_us_upper=.
//replace yline_func_us_upper=8.47 if inrange(Xpos_country, 1, 6)
//gen yline_rel_us=.
//replace yline_rel_us=7.74 if inrange(Xpos_country, 6, 11)
//gen yline_rel_us_lower=.
//replace yline_rel_us_lower=7.66 if inrange(Xpos_country, 6, 11)
//gen yline_rel_us_upper=.
//replace yline_rel_us_upper=7.81 if inrange(Xpos_country, 6, 11)
*DE
//gen yline_func_de=.
//replace yline_func_de=8.49 if inrange(Xpos_country, 1, 6)
//gen yline_func_de_lower=.
//replace yline_func_de_lower=8.43 if inrange(Xpos_country, 1, 6)
//gen yline_func_de_upper=.
//replace yline_func_de_upper=8.55 if inrange(Xpos_country, 1, 6)
//gen yline_rel_de=.
//replace yline_rel_de=7.40 if inrange(Xpos_country, 6, 11)
//gen yline_rel_de_lower=.
//replace yline_rel_de_lower=7.32 if inrange(Xpos_country, 6, 11)
//gen yline_rel_de_upper=.
//replace yline_rel_de_upper=7.47 if inrange(Xpos_country, 6, 11)
*Produce country specific graphs
graph set window fontface "Times New Roman"
*Denmark
tw (rspike lower upper Xpos_country if country==1, vertical) (scatter mean Xpos_country if country==1) (line yline_func_dk Xpos_country if !missing(yline_func_dk)) (line yline_func_dk_lower Xpos_country if !missing(yline_func_dk)) (line yline_func_dk_upper Xpos_country if !missing(yline_func_dk)) (line yline_rel_dk Xpos_country if !missing(yline_rel_dk)) (line yline_rel_dk_lower Xpos_country if !missing(yline_rel_dk))(line yline_rel_dk_upper Xpos_country if !missing(yline_rel_dk)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*UK
tw (rspike lower upper Xpos_country if country==2, vertical) (scatter mean Xpos_country if country==2) (line yline_func_uk Xpos_country if !missing(yline_func_uk)) (line yline_func_uk_lower Xpos_country if !missing(yline_func_uk)) (line yline_func_uk_upper Xpos_country if !missing(yline_func_uk)) (line yline_rel_uk Xpos_country if !missing(yline_rel_uk)) (line yline_rel_uk_lower Xpos_country if !missing(yline_rel_uk))(line yline_rel_uk_upper Xpos_country if !missing(yline_rel_uk)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*US
tw (rspike lower upper Xpos_country if country==3, vertical) (scatter mean Xpos_country if country==3) (line yline_func_us Xpos_country if !missing(yline_func_us)) (line yline_func_us_lower Xpos_country if !missing(yline_func_us)) (line yline_func_us_upper Xpos_country if !missing(yline_func_us)) (line yline_rel_us Xpos_country if !missing(yline_rel_us)) (line yline_rel_us_lower Xpos_country if !missing(yline_rel_us))(line yline_rel_us_upper Xpos_country if !missing(yline_rel_us)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*DE
tw (rspike lower upper Xpos_country if country==4, vertical) (scatter mean Xpos_country if country==4)(line yline_func_de Xpos_country if !missing(yline_func_de)) (line yline_func_de_lower Xpos_country if !missing(yline_func_de)) (line yline_func_de_upper Xpos_country if !missing(yline_func_de)) (line yline_rel_de Xpos_country if !missing(yline_rel_de)) (line yline_rel_de_lower Xpos_country if !missing(yline_rel_de))(line yline_rel_de_upper Xpos_country if !missing(yline_rel_de)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*All graphs are edited with graph editor in stata, combined in powerpoint, and saved in TIFF


**************************************************************************************
********************************Figur C1**********************************************
**************************************************************************************
*use data "Legislator or Representative Wide.dta"
ttest q2_1, by(gender) 
ttest q2_2, by(gender) 
ttest q2_3, by(gender) 
ttest q2_4, by(gender) 
ttest q2_5, by(gender) 
ttest q2_6, by(gender) 
ttest q2_7, by(gender) 
ttest q2_8, by(gender) 
ttest q2_9, by(gender) 
ttest q2_10, by(gender) 
gen functional=(q2_1+q2_2+q2_3+q2_4+q2_5)/5
gen relational=(q2_6+q2_7+q2_8+q2_9+q2_10)/5
mean functional, over(gender)
mean relational, over(gender)
by gender, sort : ttest functional == relational
*Results stored in new data set Figure C1
*use data "Figure C1.dta"
*Prepare lines for figure C1
//gen yline_func_fem=.
//replace yline_func_fem=8.50 if inrange(Xpos, 1, 6)
//gen yline_func_fem_lower=.
//replace yline_func_fem_lower=8.45 if inrange(Xpos, 1, 6)
//gen yline_func_fem_upper=.
//replace yline_func_fem_upper=8.54 if inrange(Xpos, 1, 6)
//gen yline_func_mal=.
//replace yline_func_mal=8.32 if inrange(Xpos, 1, 6)
//gen yline_func_mal_lower=.
//replace yline_func_mal_lower=8.28 if inrange(Xpos, 1, 6)
//gen yline_func_mal_upper=.
//replace yline_func_mal_upper=8.37 if inrange(Xpos, 1, 6)
//gen yline_rel_fem=.
//replace yline_rel_fem=7.48 if inrange(Xpos, 6, 11.15)
//gen yline_rel_fem_lower=.
//replace yline_rel_fem_lower=7.43 if inrange(Xpos, 6, 11.15)
//gen yline_rel_fem_upper=.
//replace yline_rel_fem_upper=7.53 if inrange(Xpos, 6, 11.15)
//gen yline_rel_mal=.
//replace yline_rel_mal=7.40 if inrange(Xpos, 6, 11.15)
//gen yline_rel_mal_lower=.
//replace yline_rel_mal_lower=7.34 if inrange(Xpos, 6, 11.15)
//gen yline_rel_mal_upper=.
//replace yline_rel_mal_upper=7.44 if inrange(Xpos, 6, 11.15)
*Produce figure C1
graph set window fontface "Times New Roman"
tw (rspike lower upper Xpos, vertical) (scatter mean Xpos if gender==1) (scatter mean Xpos if gender==2) (line yline_func_fem Xpos if !missing(yline_func_fem)) (line yline_func_fem_lower Xpos if !missing(yline_func_fem)) (line yline_func_fem_upper Xpos if !missing(yline_func_fem)) (line yline_rel_fem Xpos if !missing(yline_rel_fem)) (line yline_rel_fem_lower Xpos if !missing(yline_rel_fem))(line yline_rel_fem_upper Xpos if !missing(yline_rel_fem)) (line yline_func_mal Xpos if !missing(yline_func_mal)) (line yline_func_mal_lower Xpos if !missing(yline_func_mal)) (line yline_func_mal_upper Xpos if !missing(yline_func_mal)) (line yline_rel_mal Xpos if !missing(yline_rel_mal)) (line yline_rel_mal_lower Xpos if !missing(yline_rel_mal))(line yline_rel_mal_upper Xpos if !missing(yline_rel_mal)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings"  8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval") label(2 "Women") label(3 "Men")) 
*Graph is edited using stata graph editor
*Test for note to figure C1: Test gender differences across countries
*use data "Legislator or Representative Wide.dta"
reg q2_1 i.monadic i.gender
reg q2_2 i.monadic i.gender
reg q2_3 i.monadic i.gender
reg q2_4 i.monadic i.gender
reg q2_5 i.monadic i.gender
reg q2_6 i.monadic i.gender
reg q2_7 i.monadic i.gender
reg q2_8 i.monadic i.gender
reg q2_9 i.monadic i.gender
reg q2_10 i.monadic i.gender
reg functional i.monadic i.gender
reg relational i.monadic i.gender


*************************************************************************************
*******************************Figure C2*********************************************
*************************************************************************************
*use data "Legislator or Representative Wide.dta"
recode q16 (1=0) (2=0) (3=1) (4=1), gen(polint)
ttest q2_1, by(polint) 
ttest q2_2, by(polint) 
ttest q2_3, by(polint) 
ttest q2_4, by(polint) 
ttest q2_5, by(polint) 
ttest q2_6, by(polint) 
ttest q2_7, by(polint) 
ttest q2_8, by(polint) 
ttest q2_9, by(polint) 
ttest q2_10, by(polint) 
mean functional, over(polint)
mean relational, over(polint)
by polint, sort : ttest functional == relational
*Store esitmates in new dataset Figure C2
*use data "Figure C2.dta"
*Prepare lines for figure
//gen yline_func_polint=.
//replace yline_func_polint=8.53 if inrange(Xpos, 1, 6)
//gen yline_func_polint_lower=.
//replace yline_func_polint_lower=8.50 if inrange(Xpos, 1, 6)
//gen yline_func_polint_upper=.
//replace yline_func_polint_upper=8.56 if inrange(Xpos, 1, 6)
//gen yline_func_noint=.
//replace yline_func_noint=7.93 if inrange(Xpos, 1, 6)
//gen yline_func_noint_lower=.
//replace yline_func_noint_lower=7.85 if inrange(Xpos, 1, 6)
//gen yline_func_noint_upper=.
//replace yline_func_noint_upper=8.00 if inrange(Xpos, 1, 6)
//gen yline_rel_polint=.
//replace yline_rel_polint=7.53 if inrange(Xpos, 6, 11.15)
//gen yline_rel_polint_lower=.
//replace yline_rel_polint_lower=7.49 if inrange(Xpos, 6, 11.15)
//gen yline_rel_polint_upper=.
//replace yline_rel_polint_upper=7.57 if inrange(Xpos, 6, 11.15)
//gen yline_rel_noint=.
//replace yline_rel_noint=7.06 if inrange(Xpos, 6, 11.15)
//gen yline_rel_noint_lower=.
//replace yline_rel_noint_lower=6.97 if inrange(Xpos, 6, 11.15)
//gen yline_rel_noint_upper=.
//replace yline_rel_noint_upper=7.14 if inrange(Xpos, 6, 11.15)
*Produces figure C2
graph set window fontface "Times New Roman"
tw (rspike lower upper Xpos, vertical) (scatter mean Xpos if polint==1) (scatter mean Xpos if polint==0) (line yline_func_polint Xpos if !missing(yline_func_polint)) (line yline_func_polint_lower Xpos if !missing(yline_func_polint)) (line yline_func_polint_upper Xpos if !missing(yline_func_polint)) (line yline_rel_polint Xpos if !missing(yline_rel_polint)) (line yline_rel_polint_lower Xpos if !missing(yline_rel_polint))(line yline_rel_polint_upper Xpos if !missing(yline_rel_polint)) (line yline_func_noint Xpos if !missing(yline_func_noint)) (line yline_func_noint_lower Xpos if !missing(yline_func_noint)) (line yline_func_noint_upper Xpos if !missing(yline_func_noint)) (line yline_rel_noint Xpos if !missing(yline_rel_noint)) (line yline_rel_noint_lower Xpos if !missing(yline_rel_noint))(line yline_rel_noint_upper Xpos if !missing(yline_rel_noint)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval") label(2 "Political interest") label(3 "No political interest")) 
*Graph is edited in stata graph editor
*Test to note to figure C2: Differences across political interest and country
*use data "Legislator or Representative Wide.dta"
reg q2_1 i.monadic i.polint
reg q2_2 i.monadic i.polint
reg q2_3 i.monadic i.polint
reg q2_4 i.monadic i.polint
reg q2_5 i.monadic i.polint
reg q2_6 i.monadic i.polint
reg q2_7 i.monadic i.polint
reg q2_8 i.monadic i.polint
reg q2_9 i.monadic i.polint
reg q2_10 i.monadic i.polint
reg functional i.monadic i.polint
reg relational i.monadic i.polint


************************************************************************
******************************Figure C3*********************************
************************************************************************
*use data "Legislator or Representative Wide.dta"
recode q9 (1/3=0) (4/7=1) (8=.), gen (trust)
ttest q2_1, by(trust) 
ttest q2_2, by(trust) 
ttest q2_3, by(trust) 
ttest q2_4, by(trust) 
ttest q2_5, by(trust) 
ttest q2_6, by(trust) 
ttest q2_7, by(trust) 
ttest q2_8, by(trust) 
ttest q2_9, by(trust) 
ttest q2_10, by(trust) 
mean functional, over(trust)
mean relational, over(trust)
by trust, sort : ttest functional == relational
*Store estimates in new data set Figure C3
*use data "Figure C3.dta"
*Prepare lines for Figure C3
//gen yline_func_trust=.
//replace yline_func_trust=8.41 if inrange(Xpos, 1, 6)
//gen yline_func_trust_lower=.
//replace yline_func_trust_lower=8.38 if inrange(Xpos, 1, 6)
//gen yline_func_trust_upper=.
//replace yline_func_trust_upper=8.45 if inrange(Xpos, 1, 6)
//gen yline_func_notrust=.
//replace yline_func_notrust=8.42 if inrange(Xpos, 1, 6)
//gen yline_func_notrust_lower=.
//replace yline_func_notrust_lower=8.38 if inrange(Xpos, 1, 6)
//gen yline_func_notrust_upper=.
//replace yline_func_notrust_upper=8.47 if inrange(Xpos, 1, 6)
//gen yline_rel_trust=.
//replace yline_rel_trust=7.42 if inrange(Xpos, 6, 11.15)
//gen yline_rel_trust_lower=.
//replace yline_rel_trust_lower=7.38 if inrange(Xpos, 6, 11.15)
//gen yline_rel_trust_upper=.
//replace yline_rel_trust_upper=7.47 if inrange(Xpos, 6, 11.15)
//gen yline_rel_notrust=.
//replace yline_rel_notrust=7.46 if inrange(Xpos, 6, 11.15)
//gen yline_rel_notrust_lower=.
//replace yline_rel_notrust_lower=7.40 if inrange(Xpos, 6, 11.15)
//gen yline_rel_notrust_upper=.
//replace yline_rel_notrust_upper=7.52 if inrange(Xpos, 6, 11.15)
*Produces figure
graph set window fontface "Times New Roman"
tw (rspike lower upper Xpos, vertical) (scatter mean Xpos if poltrust==1) (scatter mean Xpos if poltrust==0) (line yline_func_trust Xpos if !missing(yline_func_trust)) (line yline_func_trust_lower Xpos if !missing(yline_func_trust)) (line yline_func_trust_upper Xpos if !missing(yline_func_trust)) (line yline_rel_trust Xpos if !missing(yline_rel_trust)) (line yline_rel_trust_lower Xpos if !missing(yline_rel_trust))(line yline_rel_trust_upper Xpos if !missing(yline_rel_trust)) (line yline_func_notrust Xpos if !missing(yline_func_notrust)) (line yline_func_notrust_lower Xpos if !missing(yline_func_notrust)) (line yline_func_notrust_upper Xpos if !missing(yline_func_notrust)) (line yline_rel_notrust Xpos if !missing(yline_rel_notrust)) (line yline_rel_notrust_lower Xpos if !missing(yline_rel_notrust))(line yline_rel_notrust_upper Xpos if !missing(yline_rel_notrust)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval") label(2 "High political trust") label(3 "Low political trust")) 
*Test note to figure C3: Differences across trust and country
*use data "Legislator or Representative Wide.dta"
reg q2_1 i.monadic i.trust
reg q2_2 i.monadic i.trust
reg q2_3 i.monadic i.trust
reg q2_4 i.monadic i.trust
reg q2_5 i.monadic i.trust
reg q2_6 i.monadic i.trust
reg q2_7 i.monadic i.trust
reg q2_8 i.monadic i.trust
reg q2_9 i.monadic i.trust
reg q2_10 i.monadic i.trust
reg functional i.monadic i.trust
reg relational i.monadic i.trust


********************************************************************************
**************************Figure 2**********************************************
********************************************************************************
*use data "Legislator or Representative Wide.dta"
mean q3_1_1 q3_2_1 q3_3_1 q3_4_1 q3_5_1 q3_6_1 q3_7_1 q3_8_1 q3_9_1 q3_10_1 if monadic==1 //DK
mean q3_1_1 q3_2_1 q3_3_1 q3_4_1 q3_5_1 q3_6_1 q3_7_1 q3_8_1 q3_9_1 q3_10_1 if monadic==2 //UK
mean q3_1_1 q3_2_1 q3_3_1 q3_4_1 q3_5_1 q3_6_1 q3_7_1 q3_8_1 q3_9_1 q3_10_1 if monadic==3 //US
mean q3_1_1 q3_2_1 q3_3_1 q3_4_1 q3_5_1 q3_6_1 q3_7_1 q3_8_1 q3_9_1 q3_10_1 if monadic==4 //DE
gen func_time=(q3_1_1+q3_2_1+q3_3_1+q3_4_1+q3_5_1)/5
gen rel_time=(q3_6_1+q3_7_1+q3_8_1+q3_9_1+q3_10_1)/5
mean func_time, over(monadic)
mean rel_time, over(monadic)
by monadic, sort : ttest func_time == rel_time
*Store estimates in new data set Figure 2
*use data "Figure 2.dta"
*Prepare lines for Figure 2
*DK
//gen yline_functime_dk=.
//replace yline_functime_dk=12.96 if inrange(Xpos_country, 1, 6)
//gen yline_functime_dk_lower=.
//replace yline_functime_dk_lower=12.83 if inrange(Xpos_country, 1, 6)
//gen yline_functime_dk_upper=.
//replace yline_functime_dk_upper=13.09 if inrange(Xpos_country, 1, 6)
//gen yline_reltime_dk=.
//replace yline_reltime_dk=7.04 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_dk_lower=.
//replace yline_reltime_dk_lower=6.91 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_dk_upper=.
//replace yline_reltime_dk_upper=7.17 if inrange(Xpos_country, 6, 11)
*UK
//gen yline_functime_uk=.
//replace yline_functime_uk=10.73 if inrange(Xpos_country, 1, 6)
//gen yline_functime_uk_lower=.
//replace yline_functime_uk_lower=10.62 if inrange(Xpos_country, 1, 6)
//gen yline_functime_uk_upper=.
//replace yline_functime_uk_upper=10.83 if inrange(Xpos_country, 1, 6)
//gen yline_reltime_uk=.
//replace yline_reltime_uk=9.27 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_uk_lower=.
//replace yline_reltime_uk_lower=9.17 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_uk_upper=.
//replace yline_reltime_uk_upper=9.38 if inrange(Xpos_country, 6, 11)
*US
//gen yline_functime_us=.
//replace yline_functime_us=11.50 if inrange(Xpos_country, 1, 6)
//gen yline_functime_us_lower=.
//replace yline_functime_us_lower=11.38 if inrange(Xpos_country, 1, 6)
//gen yline_functime_us_upper=.
//replace yline_functime_us_upper=11.63 if inrange(Xpos_country, 1, 6)
//gen yline_reltime_us=.
//replace yline_reltime_us=8.50 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_us_lower=.
//replace yline_reltime_us_lower=8.37 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_us_upper=.
//replace yline_reltime_us_upper=8.62 if inrange(Xpos_country, 6, 11)
*DE
//gen yline_functime_de=.
//replace yline_functime_de=11.62 if inrange(Xpos_country, 1, 6)
//gen yline_functime_de_lower=.
//replace yline_functime_de_lower=11.50 if inrange(Xpos_country, 1, 6)
//gen yline_functime_de_upper=.
//replace yline_functime_de_upper=11.75 if inrange(Xpos_country, 1, 6)
//gen yline_reltime_de=.
//replace yline_reltime_de=8.38 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_de_lower=.
//replace yline_reltime_de_lower=8.25 if inrange(Xpos_country, 6, 11)
//gen yline_reltime_de_upper=.
//replace yline_reltime_de_upper=8.50 if inrange(Xpos_country, 6, 11)
*Country specific figures are produced
graph set window fontface "Times New Roman"
*DK
tw (rspike lower_time upper_time Xpos_country if country==1, vertical) (scatter mean_time Xpos_country if country==1) (line yline_functime_dk Xpos_country if !missing(yline_functime_dk)) (line yline_functime_dk_lower Xpos_country if !missing(yline_functime_dk)) (line yline_functime_dk_upper Xpos_country if !missing(yline_functime_dk)) (line yline_reltime_dk Xpos_country if !missing(yline_reltime_dk)) (line yline_reltime_dk_lower Xpos_country if !missing(yline_reltime_dk))(line yline_reltime_dk_upper Xpos_country if !missing(yline_reltime_dk)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*UK
tw (rspike lower_time upper_time Xpos_country if country==2, vertical) (scatter mean_time Xpos_country if country==2) (line yline_functime_uk Xpos_country if !missing(yline_functime_uk)) (line yline_functime_uk_lower Xpos_country if !missing(yline_functime_uk)) (line yline_functime_uk_upper Xpos_country if !missing(yline_functime_uk)) (line yline_reltime_uk Xpos_country if !missing(yline_reltime_uk)) (line yline_reltime_uk_lower Xpos_country if !missing(yline_reltime_uk))(line yline_reltime_uk_upper Xpos_country if !missing(yline_reltime_uk)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*US
tw (rspike lower_time upper_time Xpos_country if country==3, vertical) (scatter mean_time Xpos_country if country==3) (line yline_functime_us Xpos_country if !missing(yline_functime_us)) (line yline_functime_us_lower Xpos_country if !missing(yline_functime_us)) (line yline_functime_us_upper Xpos_country if !missing(yline_functime_us)) (line yline_reltime_us Xpos_country if !missing(yline_reltime_us)) (line yline_reltime_us_lower Xpos_country if !missing(yline_reltime_us))(line yline_reltime_us_upper Xpos_country if !missing(yline_reltime_us)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*DE
tw (rspike lower_time upper_time Xpos_country if country==4, vertical) (scatter mean_time Xpos_country if country==4) (line yline_functime_de Xpos_country if !missing(yline_functime_de)) (line yline_functime_de_lower Xpos_country if !missing(yline_functime_de)) (line yline_functime_de_upper Xpos_country if !missing(yline_functime_de)) (line yline_reltime_de Xpos_country if !missing(yline_reltime_de)) (line yline_reltime_de_lower Xpos_country if !missing(yline_reltime_de))(line yline_reltime_de_upper Xpos_country if !missing(yline_reltime_de)), xlabel(1 "Legislative scrutiny" 2 "Negotiations" 3 "Parliamentary meetings" 4 "Oversight" 5 "Parliamentary agenda setting" 7 "Local party meetings" 8 "Public debate participation" 9 "Present self to public" 10 "Present own policy to public" 11 "Contact to constituency", angle(vertical) nogrid notick) xtit("") xline(6) legend(pos(4) label(1 "95% confidence interval"))
*All graphs are edited with graph editor in stata, combined in powerpoint, and saved in TIFF


********************************************************************************
******************************Figure 3******************************************
********************************************************************************
*use data "Legislator or Representative Wide.dta"
*Prepare reshape
drop q2_1 q2_2 q2_3 q2_4 q2_5 q2_6 q2_7 q2_8 q2_9 q2_10 q3_1_1 q3_2_1 q3_3_1 q3_4_1 q3_5_1 q3_6_1 q3_7_1 q3_8_1 q3_9_1 q3_10_1 q9 q16 q17 duration gender age age1 age2 age3 age4 
*Renames variables
rename q_attr1_concept1_task1 fornavn1
rename q_attr2_concept1_task1 efternavn1
rename q_attr3_concept1_task1 alder1
rename q_attr4_concept1_task1 aar1
rename q_attr5_concept1_task1 erhverv1
rename q_attr6_concept1_task1 opgave1
rename q_attr1_concept2_task1 fornavn2
rename q_attr2_concept2_task1 efternavn2
rename q_attr3_concept2_task1 alder2
rename q_attr4_concept2_task1 aar2
rename q_attr5_concept2_task1 erhverv2
rename q_attr6_concept2_task1 opgave2
rename q_attr1_concept1_task2 fornavn3
rename q_attr2_concept1_task2 efternavn3
rename q_attr3_concept1_task2 alder3
rename q_attr4_concept1_task2 aar3
rename q_attr5_concept1_task2 erhverv3
rename q_attr6_concept1_task2 opgave3
rename q_attr1_concept2_task2 fornavn4
rename q_attr2_concept2_task2 efternavn4
rename q_attr3_concept2_task2 alder4
rename q_attr4_concept2_task2 aar4
rename q_attr5_concept2_task2 erhverv4
rename q_attr6_concept2_task2 opgave4
rename q_attr1_concept1_task3 fornavn5
rename q_attr2_concept1_task3 efternavn5
rename q_attr3_concept1_task3 alder5
rename q_attr4_concept1_task3 aar5
rename q_attr5_concept1_task3 erhverv5
rename q_attr6_concept1_task3 opgave5
rename q_attr1_concept2_task3 fornavn6
rename q_attr2_concept2_task3 efternavn6
rename q_attr3_concept2_task3 alder6
rename q_attr4_concept2_task3 aar6
rename q_attr5_concept2_task3 erhverv6
rename q_attr6_concept2_task3 opgave6
rename q_attr1_concept1_task4 fornavn7
rename q_attr2_concept1_task4 efternavn7
rename q_attr3_concept1_task4 alder7
rename q_attr4_concept1_task4 aar7
rename q_attr5_concept1_task4 erhverv7
rename q_attr6_concept1_task4 opgave7
rename q_attr1_concept2_task4 fornavn8
rename q_attr2_concept2_task4 efternavn8
rename q_attr3_concept2_task4 alder8
rename q_attr4_concept2_task4 aar8
rename q_attr5_concept2_task4 erhverv8
rename q_attr6_concept2_task4 opgave8

rename q4a_taskeen1 valg1
recode valg1 (1=1) (2=0)
generate valg2 = ., after(valg1)
recode valg2 (.=1) if valg1==0
recode valg2 (.=0) if valg1==1
rename q4a_taskeen2 valg3
recode valg3 (1=1) (2=0)
generate valg4 = ., after(valg3)
recode valg4 (.=1) if valg3==0
recode valg4 (.=0) if valg3==1
rename q4a_taskeen3 valg5
recode valg5 (1=1) (2=0)
generate valg6 = ., after(valg5)
recode valg6 (.=1) if valg5==0
recode valg6 (.=0) if valg5==1
rename q4a_taskeen4 valg7
recode valg7 (1=1) (2=0)
generate valg8 = ., after(valg7)
recode valg8 (.=1) if valg7==0
recode valg8 (.=0) if valg7==1

label define valg 1 "valgt" 0 "ikke valgt"
label values valg1 valg
label values valg2 valg
label values valg3 valg
label values valg4 valg
label values valg5 valg
label values valg6 valg
label values valg7 valg
label values valg8 valg
label variable valg1 "kandidatvalg"
label variable valg2 "kandidatvalg"
label variable valg3 "kandidatvalg"
label variable valg4 "kandidatvalg"
label variable valg5 "kandidatvalg"
label variable valg6 "kandidatvalg"
label variable valg7 "kandidatvalg"
label variable valg8 "kandidatvalg"

*generate IDs
generate id = _n, before(fornavn1)

*Reshape data from wide to long
reshape long fornavn efternavn alder aar erhverv opgave valg, i(id) j(kandidat)

*Define attributes
recode fornavn (1/20=1) (21/30=0) (31/50=1) (51/60=0), gen(ethnic_majority)
recode fornavn (1/30=1) (31/60=0), gen(female)
recode alder (1/10=1) (11/25=2) (26/31=3), gen(generation)
label define generation 1 "young (25-34)" 2 "middle age (40-54)" 3 "older (60-65)"
label values generation generation
recode aar (1/3=1) (4/6=2) (7/9=3), gen(workexperience)
label define workexperience 1 "short (1-3)" 2 "medium (7-9)" 3 "long (13-15)"
label values workexperience workexperience
recode erhverv (1/6=1) (7/14=2) (15/25=3) (101/106=1) (107/114=2) (115/125=3), gen(education)
label define education 1 "short" 2 "medium" 3 "long"
label values education education
recode opgave (1=1) (2=0) (3=1) (4=0) (5=1) (6=0) (7=1) (8=0) (101=1) (102=0) (103=1) (104=0) (105=1) (106=0) (107=1) (108=0), gen(functional)

*Analyses
*DK
conjoint valg ethnic_majority female generation workexperience education functional if monadic == 1, est(amce) id(id) constraint(generation#workexperience)
*UK
conjoint valg ethnic_majority female generation workexperience education functional if monadic == 2, est(amce) id(id) constraint(generation#workexperience)
*US
conjoint valg ethnic_majority female generation workexperience education functional if monadic == 3, est(amce) id(id) constraint(generation#workexperience)
*DE
conjoint valg ethnic_majority female generation workexperience education functional if monadic == 4, est(amce) id(id) constraint(generation#workexperience)
*Results stored in a new data set Figure 3

*Produces figure 3
*use data "Figure 3.dta"
graph set window fontface "Times New Roman"
*DK
tw (rspike lower upper Ypos_country if Country==1, horizontal) (scatter Ypos_country AMCE if Country==1), ylabel(1 "Ethnic majority name" 1.5 "Female name" 2 "Medium age (40-54 years)" 2.5 "Older (60-65 years)" 3 "Medium long education" 3.5 "Long education" 4 "Medium work experience (7-9 years)" 4.5 "Long work experience (13-15 years)" 5 "Functional task", angle(horizontal) nogrid notick) ytit("") yscale(range(0.8 5.2)) ytick(0.8 5.2, notick) xtit("") xline(0)legend(label(1 "95% confidence interval") label(2 "AMCE"))
*UK
tw (rspike lower upper Ypos_country if Country==2, horizontal) (scatter Ypos_country AMCE if Country==2), ylabel(1 "Ethnic majority name" 1.5 "Female name" 2 "Medium age (40-54 years)" 2.5 "Older (60-65 years)" 3 "Medium long education" 3.5 "Long education" 4 "Medium work experience (7-9 years)" 4.5 "Long work experience (13-15 years)" 5 "Functional task", angle(horizontal) nogrid notick) ytit("") yscale(range(0.8 5.2)) ytick(0.8 5.2, notick) xtit("") xline(0)legend(label(1 "95% confidence interval") label(2 "AMCE"))
*US
tw (rspike lower upper Ypos_country if Country==3, horizontal) (scatter Ypos_country AMCE if Country==3), ylabel(1 "Ethnic majority name" 1.5 "Female name" 2 "Medium age (40-54 years)" 2.5 "Older (60-65 years)" 3 "Medium long education" 3.5 "Long education" 4 "Medium work experience (7-9 years)" 4.5 "Long work experience (13-15 years)" 5 "Functional task", angle(horizontal) nogrid notick) ytit("") yscale(range(0.8 5.2)) ytick(0.8 5.2, notick) xtit("") xline(0)legend(label(1 "95% confidence interval") label(2 "AMCE"))
*DE
tw (rspike lower upper Ypos_country if Country==4, horizontal) (scatter Ypos_country AMCE if Country==4), ylabel(1 "Ethnic majority name" 1.5 "Female name" 2 "Medium age (40-54 years)" 2.5 "Older (60-65 years)" 3 "Medium long education" 3.5 "Long education" 4 "Medium work experience (7-9 years)" 4.5 "Long work experience (13-15 years)" 5 "Functional task", angle(horizontal) nogrid notick) ytit("") yscale(range(0.8 5.2)) ytick(0.8 5.2, notick) xtit("") xline(0)legend(label(1 "95% confidence interval") label(2 "AMCE"))
*All graphs are edited with graph editor in stata, combined in powerpoint, and saved in TIFF